package com.jlpay.openapi.demo.openmerch.bill;

import com.jlpay.open.jlpay.sdk.java.model.openmerch.bill.request.BillDownloadQueryRequest;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.bill.response.BillDownloadQueryResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 商户信息修改
 * @author chenjunhong
 * @date 2024/4/15
 */
public class OpenBillDownloadQueryService {
    private static final Logger LOGGER = LoggerFactory.getLogger(OpenBillDownloadQueryService.class);

    public static void main(String[] args) {
        BillDownloadQueryRequest request = buildBillDownloadQueryRequest();
        BillDownloadQueryResponse response = JlpayOpenApiService.openMerchService()
                .post(request, BillDownloadQueryResponse.class);
        LOGGER.info("账单下载查询结果:{}", JsonUtils.toString(response));
    }

    private static BillDownloadQueryRequest buildBillDownloadQueryRequest() {
        BillDownloadQueryRequest request = new BillDownloadQueryRequest();
        // 1-日交易账单
        request.setBillType("1");
        // 账期(yyyyMMdd)
        request.setDt("20230401");
        return request;
    }
}
